package com.ny.封装;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Emp emp1 = new Emp("01", "佩奇", 20);
        System.out.println(emp1.getN());
        System.out.println(emp1.getName());
        System.out.println(emp1.getAge());
        Emp emp2 = new Emp("02", "苏火山", 20);
        System.out.println(emp2.getN());
        System.out.println(emp2.getName());
        System.out.println(emp2.getAge());
        Emp emp3 = new Emp("03", "孙木水", 20);
        System.out.println(emp3.getN());
        System.out.println(emp3.getName());
        System.out.println(emp3.getAge());


        TestList testList = new TestList();
        List<Emp> list = new ArrayList<>();
        list.add(emp1);
        list.add(emp2);
        list.add(emp3);
        System.out.println("欢迎来到员工信息管理系统");
        System.out.println("1.查询员工信息");
        System.out.println("2.删除员工信息");
        System.out.println("3.修改员工信息");
        System.out.println("请输入你需要进行的操作");
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        switch (n) {
            case 1:
                for (int i = 0; i < list.size(); i++) {
                    System.out.println(list.get(i));
                }
                break;
            case 2:
                for (int i = 0; i < list.size(); i++) {
                    System.out.println(list.get(i));
                }
                System.out.println("请输入你需要删除那个员工的编号");
                String num = scanner.next();
                testList.deleteEmpNumber(list, num);
                break;
            case 3:
                for (int i = 0; i < list.size(); i++) {
                    System.out.println(list.get(i));
                }
                System.out.println("请输入你需要修改的员工编号");
                String updateNumber = scanner.next();
                Emp updateTest = testList.findTestNumber(list, updateNumber);
                System.out.println("请输入你需要修改的员工的年龄");
                int updateAge = scanner.nextInt();
                updateTest.setAge(updateAge);

        }
    }
}